﻿using InfonavaEye.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InfonavaEye.components
{
    public partial class UniPageHeader : UserControl
    {

        private bool showHome = true;
        /// <summary>
        /// 显示系统设置:true显示，false不显示
        /// </summary>
        [Browsable(true), Category("外观"), Description("显示系统设置:true显示，false不显示")]
        public bool ShowSetting
        {
            get; set;
        }

        /// <summary>
        /// 显示Home主页:true显示，false不显示
        /// </summary>
        [Browsable(true), Category("外观"), Description("显示Home主页:true显示，false不显示")]
        public bool ShowHome
        {
            get { return showHome; }
            set { showHome = value; }
        }

        public UniPageHeader()
        {
            InitializeComponent();
        }

        private void UniPageHeader_SizeChanged(object sender, EventArgs e)
        {
            btnSetting.Location = new Point(this.Width - 60, this.Location.Y + 5);
        }

        private void btnSetting_Click(object sender, EventArgs e)
        {
            SettingForm form = new SettingForm();
            form.ShowDialog();
        }

        private void UniPageHeader_Load(object sender, EventArgs e)
        {
            this.btnSetting.Visible = ShowSetting;
            this.btnHome.Visible = ShowHome;
        }

        private void btnHome_Click(object sender, EventArgs e)
        {
            this.ParentForm.Close();
        }
    }
}
